<?php
/**
 * Created by PhpStorm.
 * User: yunzhi.liu
 * Date: 2020/9/25
 * Time: 10:36
 */

namespace app\services\pay;


use app\models\order\OrderModel;
use app\services\order\OrderService;
use app\strategy\pay\PayInterface;

class PayService
{
    private $strategy;

    /**
     * @param mixed $strategy
     */
    public function setStrategy(PayInterface $strategy)
    {
        $this->strategy = $strategy;
    }

    public function pay($userId, $orderSn, $amount, $subject, $notifyUrl)
    {
        return $this->strategy->pay($userId, $orderSn, $amount, $subject, $notifyUrl);
    }

    public function refund($orderId, $cancelType)
    {
        return $this->strategy->refund($orderId, $cancelType);
    }
}